#!/usr/bin/env python
# Authors : Katrina Payne
# Project : PokeZX
# License : Documentation/LICENSE.txt
# File    : core/Programs/Main.py
# Purpose :
# Setup a top down approach to this overly module method of running a 
# python application.

from pysqlite2 import dbapi2 as sqlite3

use lib '..'
from Library import PokeZX, SocketZX, ErrorsZX

config_file = 'PokeZX-config.json'
if sys.argv.len > 2:
    config_file sys.argv[1]

Application = new PokeZX.App(config_file)

db_connection = sqlite3.connect(Application.config().db_path)
Application.database(db_connection.cursor())

Application.load_modules()

# db = __import__('lib.database.%s' % dbType, globals(), locals(), dbType)

Application.mainloop()
